// let a = 's'
// let b = '2'

// a = a ^ b
// b = a ^ b
// a = a ^ b
// console.log(a)
// console.log(b)

// let e = 3

// e = e & (~e + 1)

// console.log(e)

let arr = [1, 6, 2, 2, 3, 3, 4, 4, 6, 7, -1]

// a ^ b
let eor = 0
//a 或者 b
let _eor = 0
for (let i = 0; i < arr.length; i++) {
  // a ^ b
  eor ^= arr[i]
}
// 最右边的1
let rightOne = eor & (~eor + 1)
for (let i = 0; i < arr.length; i++) {
  if ((rightOne & arr[i]) == 0) {
    _eor ^= arr[i]
  }
}

let a = _eor ^ eor
console.log('%c _eor:', 'font-size:16px;background: #33A5FF; color: #FFFFFF;', _eor)

console.log(a)

function insertSort(arr) {
  if (!arr || arr.length < 2) {
    return
  }

  for (let i = 1, len = arr.length; i < len; i++) {
    for (let j = i - 1; j >= 0 && arr[j] > arr[j + 1]; j--) {
      let temp = arr[j]
      arr[j] = arr[j + 1]
      arr[j + 1] = temp
    }
  }
}
// insertSort(arr)
console.log(arr)
console.log(arr.sort((a, b) => b - a))
